Skip to content

Instantly share code, notes, and snippets.

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@noveogroup-amorgunov
noveogroup-amorgunov / README.md
Last active May 17, 2024 04:48
(Материалы) MoscowJS 58 - Темная сторона NextJS

(Материалы) MoscowJS 58 - Темная сторона NextJS

Про темные стороны NextJS

module RBTree
module M
def insert val
RBTree.insert self, val
end
alias :<< :insert
def include?(...) = key?(...)
end
class Leaf
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 17, 2024 04:45
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gokulkrishh
gokulkrishh / media-query.css
Last active May 17, 2024 04:45
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@ervinne13
ervinne13 / add-view-in-new-tab
Created May 17, 2024 00:02
Adds a "View in New Tab" button in nahida.live/mods so that you don't need to register and convert base64s to get to the download page.
const elements = document.querySelectorAll(`.card`);
elements.forEach(element => {
const button = document.createElement('button');
button.innerText = 'View in New Tab';
button.className = 'custom-button';
button.onclick = function () {
const imgWithUUID = element.querySelector('figure > img');
const imgUrl = imgWithUUID.src
@Kale-Ko
Kale-Ko / zsh-colors.zsh
Last active May 17, 2024 04:43
Variable and color format codes for zsh
# Colors codes for places like the PROMPT and PS1-4 variables
# Must be placed inside %{ and %}. Eg "%{$fg[red]%}"
RESET_COLOR=$reset_color
FOREGROUND_COLORS=$fg # Normal colors (black, red, green, yellow, blue, magenta, cyan, and white)
FOREGROUND_COLORS_BOLD=$fg_bold # Bright/bold colors (Most terminals display them with higher font weight)
BACKGROUND_COLORS=$bg
BACKGROUND_COLORS_BOLD=$bg_bold
@brooksvb
brooksvb / Uptime-Kuma-Status-Page-Dark-Mode-High-Density-Tweaks.css
Last active May 17, 2024 04:40
These CSS tweaks are for higher density display for Uptime Kuma status pages in dark mode.
:root {
--min-item-width: 28ch;
--max-item-width: .5fr;
--grid-spacing: .25rem;
--item-padding: .25rem;
}
/* Let items expand on small screens */
@media (max-width: 600px) {
:root {
@zchee
zchee / actionlist.vim
Last active May 17, 2024 04:39
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@triplepoint
triplepoint / wake-up-light-alarm-with-sunrise-effect.yaml
Last active May 17, 2024 04:37 — forked from sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
Home Assistant Blueprint: Wake-up light alarm with sunrise effect
blueprint:
name: Wake-up light alarm with sunrise effect
description:
"A wake-up light alarm with a brightness and color temperature sunrise
effect. Note: not manually executable!"
domain: automation
input:
light_entity:
name: Wake-up light entity
description: